package com.huifaapp.mall.activity.Homefragment.IdentActvity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.huifaapp.mall.R;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.Allidentframnet;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.ObligationFrament;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.OffthestocksFramnet;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.OverhangFramnet;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.TitleFragmentPagerAdapter;
import com.huifaapp.mall.activity.Homefragment.IdentActvity.IdentFrament.WaitreceivingFramnet;

import java.util.ArrayList;
import java.util.List;

public class purchase_orderActivity extends AppCompatActivity {
    private TabLayout mTabLayout;
    private ViewPager mViewPager;
    private List<String>  listtitle;
    private  List<Fragment> fragments;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_purchase_order);
        initview();


        TitleFragmentPagerAdapter titleFragmentPagerAdapter = new TitleFragmentPagerAdapter(getSupportFragmentManager(), fragments, listtitle);
        mViewPager.setAdapter(titleFragmentPagerAdapter);
        mTabLayout.setupWithViewPager(mViewPager);

    }

    private void initview() {
        mTabLayout = (TabLayout) findViewById(R.id.TabLayoutjinhuo);
        mViewPager = (ViewPager) findViewById(R.id.viewpagerjinhuo);
        listtitle = new ArrayList<>();
        listtitle.add("全部");
        listtitle.add("待付款");
        listtitle.add("待发货");
        listtitle.add("待收货");
        listtitle.add("已完成");

        Allidentframnet allidentframnet = new Allidentframnet();
        ObligationFrament obligationFrament = new ObligationFrament();
        OffthestocksFramnet offthestocksFramnet = new OffthestocksFramnet();
        OverhangFramnet overhangFramnet = new OverhangFramnet();
        WaitreceivingFramnet waitreceivingFramnet = new WaitreceivingFramnet();
        fragments = new ArrayList<>();
        fragments.add(allidentframnet);
        fragments.add(obligationFrament);
        fragments.add(offthestocksFramnet);
        fragments.add(overhangFramnet);
        fragments.add(waitreceivingFramnet);




    }
}
